home *** CD-ROM | disk | FTP | other *** search
- *******************************************************************************
- * ILBM handling and fade in/out example
- *******************************************************************************
- * INFO loads a 320x256x8 ILBM to a FullRes screen and then fades it
- * in and out
- * NOTE - optionally you can pass as CLI argument the names of the
- * 320x256x8 IFF/ILBMs to load (if not one of those supplied in
- * TCS/examples/pix/, make sure that yours is exactly 320x256x8
- * and that it respects all the restrictions of TCS_LdILBM(),
- * otherwise the program won't execute or the graphics will
- * look bad - not dangerous, anyway!)
- * - LMB to exit anytime
- *******************************************************************************
-
- machine 68020
-
- include INCLUDES:libraries/tcs.i
- include INCLUDES:libraries/tcs_lib.i
-
-
-
- *******************************************************************************
- * definitions
- *******************************************************************************
-
- DSPLWD = 320 ;our TCS display width and
- DSPLHT = 256 ;height in 140 ns pixels
- SCRWD = 320 ;TCS screen width and
- SCRHT = 256 ;height in pixels
- DSPLX0 = $81*4 ;display start
- DSPLY0 = $2c ;position (SHRES pixels)
- DSPLX1 = DSPLX0+DSPLWD*4 ;display end
- DSPLY1 = DSPLY0+DSPLHT ;position (SHRES pixels)
- DSPLBRTNS = 0 ;min brightness
- GFXCTXT = 0
- CWBTM = 0
- CWTOP = 0
- CWRT = 0
- CWLF = 0
- VDOMODE = TCS_VM_RGBW | TCS_VMf_FullRes ;TCS display video mode
-
- ARGSNO = 1 ;command line arguments no.
-
-
-
- *******************************************************************************
- * code start
- *******************************************************************************
-
- include /includes/macros.i
- include /includes/shl_strtup.i
-
-
-
- *******************************************************************************
- * init
- *******************************************************************************
-
- _PrgInit movea.l CmdLnArgs,a0 ;ILBM filename address
- tst.l a0
- bne.s .ld ;if filename specified...
- lea.l PicFlNm,a0 ;default ILBM
- .ld movea.l ([DIAdr.l],TCS_DI_CSAdr.w),a1 ;directly to
- move.l #SCRWD*SCRHT,d0 ;screen buffer
- CALLTCS LdILBM ;load it
- cmpi.l #TCS_PE_OK,d0 ;success?
- blo.s .fail ;if not...
- move.l d0,ILBMStrcAdr ;else store its ILBM structure address
- rts ;& clr ccr.Z to signal success
- .fail move.w #4,ccr ;signal error
- rts
-
-
-
- *******************************************************************************
- * main
- *******************************************************************************
-
- _PrgMain movea.l DIAdr,a2 ;our display
- movea.l ILBMStrcAdr,a0 ;get ILBM structure address
- movea.l (TCS_II_GfxAdr,a0),a1 ;get address of ILBM's graphic data
- move.b (TCS_II_RGBxMode,a0),d3 ;get ILBM's RGBx mode
-
- movea.l a2,a0 ;render FullRes screen
- CALLTCS CPUFRPass0 ;to make pixels visible
-
- moveq.l #0,d2 ;brightness at beginning (min)
- .FadeIn WTRSTLN DSPLY0 ;wait for Copper to write the palette
- movea.l a2,a0 ;our display
- move.b d3,d0 ;RGBx mode
- move.w d2,d1 ;brightness
- CALLTCS SetRGBx ;change palette
- addq.w #1,d2 ;increase brightness
- btst.b #6,$bfe001
- beq.s .exit ;if LMB...
- cmpi.w #256,d2
- bls.s .FadeIn ;repeat other 256 times
-
- move.w #256,d2 ;brightness at beginning (max)
- .FadeOut WTRSTLN DSPLY0 ;wait for Copper to write the palette
- movea.l a2,a0 ;our display
- move.b d3,d0 ;RGBx mode
- move.w d2,d1 ;brightness
- CALLTCS SetRGBx ;change palette
- btst.b #6,$bfe001 ;exit if LMB
- dbeq d2,.FadeOut ;decrease brightness and repeat other 256 times
- .exit rts
-
-
-
- *******************************************************************************
- * cleanup
- *******************************************************************************
-
- _PrgClnUp movea.l ILBMStrcAdr,a0 ;free all the memory
- CALLTCS UnLdILBM ;allocated for the ILBM
- rts
-
-
-
- *******************************************************************************
- * data
- *******************************************************************************
-
- include /includes/dat.i
-
- cnop 0,4
- ILBMStrcAdr dc.l 0 ;ILBM structure pointer
- tmplt dc.b "ILBM/K",0 ;template for ReadArgs()
- PicFlNm dc.b "/pix/TM_rgbw.iff",0 ;default ILBM
-